package org.xiji.Flyweight;

/**
 * 享元工厂
 *
 *
 */
public class PaperManger {
    /**
     * 卫生纸
     */
    ToiletPaperImpl toiletPaperImpl ;
    /**
     * 湿巾
     */
    WipesPaper wipesPaper ;
    public Paper getInstance(String paperType) {

        if (paperType.equals("卫生纸")) {

            if (this.toiletPaperImpl == null) {
                this.toiletPaperImpl = new ToiletPaperImpl();

            }
            return  this.toiletPaperImpl;

        }

        if (paperType.equals("湿巾")) {

            if (this.wipesPaper == null) {
                this.wipesPaper = new WipesPaper();

            }

            return this.wipesPaper;
        }

        return null;

    }


}
